package pro.softzhang.algo.lc1400;

import pro.softzhang.algo.flag.knowledge.KStack;
import pro.softzhang.algo.flag.theme.TSimulation;

import java.util.ArrayList;
import java.util.List;

@KStack
@TSimulation
public class LC1441_buildAnArrayWithStackOperations {
    public static void main(String[] args) {

    }

    static class Solution {
        public List<String> buildArray(int[] target, int n) {
            List<String> result = new ArrayList<>();
            for (int i = 1, j = 0; i <= n && j < target.length; i++) {
                result.add("Push");
                if (target[j] != i) {
                    result.add("Pop");
                } else {
                    j++;
                }
            }
            return result;
        }
    }
}
